package com.haotian.test;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class VBS脚本生成器 {

	static String savePath = "c://temp/vbs/";
	static String content = "";
	static String[] ips = { "10.102.1.141", "10.102.1.142", "10.102.1.143", "10.102.1.144", "10.102.1.145",
			"10.102.1.146", "10.102.1.147", "10.102.1.148", "10.102.1.149", "10.102.1.150", "10.102.1.211",
			"10.102.1.212", "10.102.1.213", "10.102.1.221", "10.102.1.222", "10.102.1.223", "10.102.1.224",
			"10.102.1.225", "10.102.1.226", "10.102.1.227" };

	static {

		try {
			FileReader reader = new FileReader("c://temp//vbs模板.txt");

			BufferedReader br = new BufferedReader(reader);

			String tmp = null;
			while ((tmp = br.readLine()) != null) {
				content += tmp + "\r\n";
			}

			br.close();
		} catch (IOException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}

	}

	public static void main(String[] args) throws IOException {

		for (int i = 0; i < ips.length; i++) {
			File file = new File(savePath + ips[i] + ".vbs");

			FileWriter fw = new FileWriter(file);

			fw.write(content.replace("#ip#", ips[i]));
			fw.flush();
			fw.close();

		}

	}
}
